﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MySQLStudio.Common.Data
{
    public class DbDataType : IComparable<DbDataType>
    {
        private string name;
        private bool enablelength;
        private bool enableprecision;
        private bool enablescale;
        private bool enablecollation;        
        private ulong? length;
        private ulong? precision;
        private ulong? scale;

        public DbDataType(string name, bool enablelength, bool enableprecision, bool enablescale, bool enablecollation,
            ulong? length, ulong? precision, ulong? scale)
        {
            this.name = name;
            this.enablelength = enablelength;
            this.enableprecision = enableprecision;
            this.enablescale = enablescale;
            this.enablecollation = enablecollation;
            this.length = length;
            this.precision = precision;
            this.scale = scale;
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        public bool EnableLength
        {
            get
            {
                return enablelength;
            }
            set
            {
                enablelength = value;
            }
        }

        public bool EnablePrecision
        {
            get
            {
                return enableprecision;
            }
            set
            {
                enableprecision = value;
            }
        }

        public bool EnableScale
        {
            get
            {
                return enablescale;
            }
            set
            {
                enablescale = value;
            }
        }

        public bool EnableCollation
        {
            get
            {
                return enablecollation;
            }
            set
            {
                enablecollation = value;
            }
        }

        public ulong? Length
        {
            get
            {
                return length;
            }
            set
            {
                length = value;
            }
        }

        public ulong? Precision
        {
            get
            {
                return precision;
            }
            set
            {
                precision = value;
            }
        }

        public ulong? Scale
        {
            get
            {
                return scale;
            }
            set
            {
                scale = value;
            }
        }

        #region IComparable<DbDataType> Members

        public int CompareTo(DbDataType other)
        {
           return this.name.CompareTo(other.Name);
        }

        #endregion
    }
}
